package com.learn.hibernatevalidator.chapter06.constraintcomposition.reportassingle;

import com.learn.hibernatevalidator.chapter06.constraintcomposition.CaseMode;
import com.learn.hibernatevalidator.chapter06.constraintcomposition.CheckCase;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;
import jakarta.validation.ReportAsSingleViolation;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;

import java.lang.annotation.*;

/**
 * @author: liyf
 * @create: 2025-01-18 22:21
 **/
@NotNull
@Size(min = 2, max = 14)
@CheckCase(CaseMode.UPPER)
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.TYPE_USE})
@Retention(RetentionPolicy.RUNTIME)
// 必须有
@Constraint(validatedBy = {})
@Documented
@ReportAsSingleViolation
public @interface ValidLicensePlate {

    String message() default "{org.hibernate.validator.referenceguide.chapter06." +
            "constraintcomposition.ValidLicensePlate.message}";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};
}
